package com.service.impl;

import com.dao.OperatorMapper;
import com.entity.Operator;
import com.service.OperatorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by jsb-160 on 2018/7/18.
 */
@Service("Operator")
public class OperatorServiceImpl implements OperatorService {
    @Autowired
    OperatorMapper operatorMapper;
    @Override
    public Operator getOneOperator(Integer id) {
        return operatorMapper.selectByPrimaryKey(id);
    }

    @Override
    public int deleteId(Integer id) {
        return operatorMapper.deleteByPrimaryKey(id);
    }

    public String getPassword(String mobile) {
        return operatorMapper.selectByUsernameAndPassword(mobile);
    }

    @Override
    public List<Operator> getUsers() {
        return operatorMapper.selectAllOperator();
    }

    @Override
    public Integer insertSelective(Operator operator) {
       return operatorMapper.insertSelective(operator);
    }

    @Override
    public Integer updateUser(Operator operator) {
        return operatorMapper.updateByPrimaryKeySelective(operator);
    }

    @Override
    public Operator getUserByMobile(String mobile) {
        return operatorMapper.selectByMobile(mobile);
    }

    @Override
    public Operator getOneById(Integer oid) {
        return operatorMapper.selectOneOperatorById(oid);
    }

}
